package com.jk.hearthstone.data;

import com.jk.hearthstone.card.BaseCard;
import com.jk.hearthstone.card.biology.entourage.BaseEntourage;
import com.jk.hearthstone.card.biology.hero.BaseHero;

import java.util.ArrayList;
import java.util.List;

/**
 * 游戏桌面，包括所有的手牌，在场随从及环境参数
 * @author jk
 */
public class Desktop implements Cloneable {

    public BaseHero enemy; //敌方英雄
    public BaseHero myself; //我方英雄
    public List<BaseEntourage> enemiesEntourage = new ArrayList<>(); //敌方随从
    public List<BaseEntourage> myEntourage = new ArrayList<>(); //我方随从
    public List<BaseCard> myCards = new ArrayList<>(); //我方手牌
    public List<BaseCard> enemiesCards = new ArrayList<>(); //敌方手牌

    @Override
    public Object clone() throws CloneNotSupportedException {
        Desktop result = new Desktop();
        if(enemy!=null){
            result.enemy = (BaseHero) enemy.clone();
        }
        if(myself!=null){
            result.myself = (BaseHero) myself.clone();
        }
        for (BaseEntourage entourage : enemiesEntourage) {
            result.enemiesEntourage.add((BaseEntourage) entourage.clone());
        }
        for (BaseEntourage entourage : myEntourage) {
            result.myEntourage.add((BaseEntourage) entourage.clone());
        }
        for (BaseCard card : myCards) {
            result.myCards.add((BaseCard) card.clone());
        }
        for (BaseCard card : enemiesCards) {
            result.enemiesCards.add((BaseCard) card.clone());
        }
        return result;
    }
}
